<!DOCTYPE html>
<html>

<head>
    <meta charset="utf-8" />
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <title>35 extends 扩展选项</title>
    <meta name="viewport" content="width=device-width, initial-scale=1">

    <script type="text/javascript" src="../assets/js/vue.js"></script>
</head>

<body>
    <h1> Vue 选项 extends</h1>
    <a href="../index.html">返回</a>
    <hr />
    <div id="app">
        {{message}}<br />
        $[message]
        <hr />
        现在温度是：{{newtem}}<br />
        <button @click="uptemp">升高温度</button>
        <button @click="downtemp">降低温度</button>

    </div>
    <script type="text/javascript">
        var extendObj = {
            updated: function () {
                console.log("我是扩展的updated");
            },
            methods: {
                uptemp: function () {
                    console.log("我是不能被显示的，因为命名衝突")
                }
            }
        }

        var app = new Vue({
            el: "#app",
            updated: function () {
                console.log("构造器内的updated")
            },
            data: {
                message: "data里的message, 讲解extends 选项",
                temperature: 10,
                notice: "无"
            },
            computed: {
                newtem: function () {
                    return "现在是 " + this.temperature + "度"
                }
            },
            methods: {
                uptemp: function () {
                    this.temperature += 2;
                    console.log("我是原生的方法");
                },
                downtemp: function () {
                    this.temperature -= 2;
                }
            },
            updated: function () {
                console.log("这里是原生的updated");
            },
            delimiters:["$[","]"],  //修改vue的
            extends: extendObj
        });


    </script>
</body>

</html>